package org.cl.tdd;

import java.util.Comparator;

public class SuperComparator implements Comparator<ParkingPlace> {
    public int compare(ParkingPlace o1, ParkingPlace o2) {
        double o1F = o1.getEmptyPlaceNum() / o1.getMaxSize();
        double o2F = o2.getEmptyPlaceNum() / o2.getMaxSize();
        if (o1F < o2F) {
            return 1;
        } else if (o1F == o2F) {
            return StringUtil.compareString(o1, o2);
        } else {
            return -1;
        }
    }


}
